package svc

import (
	"mall/service/blog/rpc/internal/config"

	"github.com/hibiken/asynq"
	"github.com/zeromicro/go-zero/core/service"
)

// create asynq client.
func newAsynqClient(c config.Config) *asynq.Client {
	if c.Mode != service.ProMode {
		return asynq.NewClient(asynq.RedisClientOpt{
			Addr:     c.BizRedis.Host,
			Password: c.BizRedis.Pass,
		})
	}

	return asynq.NewClient(asynq.RedisClusterClientOpt{
		Addrs:    []string{c.BizRedis.Host},
		Password: c.BizRedis.Pass,
	})
}
